home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.4)
-
- '''
- This file holds information about files, such as paths to images
- and other resources stored on a file system.
- '''
- import os
- import sys
- from spamexperts.Options import options
- from win32com.shell import shell, shellcon
- images = {
- 'base splash screen': 'base_splash_screen.png',
- 'pro splash screen': 'pro_splash_screen.png',
- 'splash screen': 'splash_screen.bmp',
- 'logo-ico': 'library.ico',
- 'tray-ico-updating': 'systray_updating.ico',
- 'tray-ico-active': 'systray_active.ico',
- 'tray-ico-balloon': 'systray_balloon.ico',
- 'logo': 'gui_logo.png',
- 'mail-icon-ham': 'mail_ham.png',
- 'mail-icon-unsure': 'mail_unsure.png',
- 'mail-icon-spam': 'mail_spam.png',
- 'mail-icon-white': 'mail_white.png',
- 'mail-icon-black': 'mail_black.png',
- 'ham-normal': 'notspam.png',
- 'unsure-normal': 'unsure.png',
- 'spam-normal': 'spam.png',
- 'whitelist-normal': 'whitelist.png',
- 'blacklist-normal': 'blacklist.png',
- 'help-icon': 'questionmark.png' }
-
- def get_image_filename(image_name, locale = 'en'):
- """Return full path to image or False if it is unknown.
-
- We look first in the user's data directory, then in the locale
- directory, then fall back to the global images directory.
- """
-
- try:
- image_file = images[image_name]
- except KeyError:
- return False
-
- image_folder = os.path.join(application_directory(), 'images')
- data_dir = shell.SHGetFolderPath(0, shellcon.CSIDL_APPDATA, 0, 0)
- for directory in (os.path.join(data_dir, options[('Storage', 'user_data_dir')]), os.path.join(get_locale_dir(), locale), image_folder):
- image_fullpath = os.path.join(directory, image_file)
- if os.path.exists(image_fullpath):
- return image_fullpath
- continue
-
- return False
-
-
- def application_directory():
- '''Convenience function.'''
- if hasattr(sys, 'frozen'):
- return os.path.dirname(sys.executable)
-
- return os.path.dirname(os.path.dirname(__file__))
-
-
- def get_locale_dir():
- return os.path.join(application_directory(), 'locale')
-
-